from game.config import ranks


class Card:
    def __init__(self, suit, rank):
        self.suit = suit
        self.rank = rank

    def __lt__(self, other):
        return ranks.index(self.rank) < ranks.index(other.rank)

    def __eq__(self, other):
        if isinstance(other, Card):
            return self.suit == other.suit and self.rank == other.rank
        return False

    def __hash__(self):
        return hash((self.suit, self.rank))

    def __repr__(self):
        return self.__str__()

    def __str__(self):
        return f'{self.rank}{self.suit}'
